/**
 * 严肃声明：
 * 开源版本请务必保留此注释头信息，若删除我方将保留所有法律责任追究！
 * 本系统已申请软件著作权，受国家版权局知识产权以及国家计算机软件著作权保护！
 * 可正常分享和学习源码，不得用于违法犯罪活动，违者必究！
 * Copyright (c) 2019-2021 十三 all rights reserved.
 * 版权所有，侵权必究！
 */
package ltd.newbee.mall.api.admin;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import ltd.newbee.mall.api.admin.vo.AdminLogOperateVo;
import ltd.newbee.mall.config.annotation.*;
import ltd.newbee.mall.service.AdminLogOperateService;
import ltd.newbee.mall.util.Result;
import ltd.newbee.mall.util.ResultGenerator;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 13
 * @qq交流群 796794009
 * @email 2449207463@qq.com
 * @link https://github.com/newbee-ltd
 */
@RestController
@Api(value = "v1", tags = "8-0.后台管理系统操作日志")
@RequestMapping("/manage-api/v1")
@Slf4j
public class AdminLogOperateAPI {

    @Resource
    private AdminLogOperateService adminLogOperateService;

    @RequestRateLimiter(time = 120, count = 30, limitType = RequestRateLimiter.LimitType.IP)
    @ApiParam(value = "查询条件", name = "vo")
    @RequestMapping(value = "/logOperate/list", method = RequestMethod.GET)
    @PreAuthorizeMethod("system:log:list")
    @LogOperate(title = "查询操作日志")
    public Result list(@ApiParam(value = "查询条件") AdminLogOperateVo vo) throws Exception {
        Page page = new Page(vo.getPageNum(), vo.getPageSize());
        return ResultGenerator.genSuccessResult(adminLogOperateService.queryAdminLogOpt(page, vo));
    }
}